
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>求阶乘</title>
		<script>
			//1正则对象
			var reg1 = /\w/i;
			var reg2 = new RegExp("\w","i");
			//2标识符
			//g: global;
			//i: ignored;
			//3标识符可以不写
			//4正则的使用
			//reg1.test("abc");
			//检测字符串是否包含与reg1匹配的部分
			var reg = /\d{3}/;//连续三位数字
			var str = "ano123def456";
			var b = reg.test(str);
			console.log(b)
			
			var reg3 = /no/g;
			console.log(reg3.exec(str))
			
			var str1 = "其实hjgljavaScript很像javajava";
			var reg4 = /java/g;
			//str1 = str1.replace(reg4,"****")
			//console.log(str1)
			// str1 = str1.match(reg4)
			// console.log(str1)
			str1 = str1.search(reg4);
			console.log(str1);
			
		</script>
	</head>
	<body>
	</body>
</html>